package org.kmobic33.simoge.modelgenerator.ui;

import org.kmobic33.simoge.modelgenerator.application.Main;

import static org.kmobic33.simoge.modelgenerator.application.Main.*;

public class ModelGeneratorRunner {

    private ModelGeneratorDriver driver;

    public void startsInNullMode() {
	Thread thread = new Thread("Test Application") {
	    @Override
	    public void run() {
		try {
		    Main.main();
		} catch (Exception e) {
		    e.printStackTrace();
		}
	    }
	};
	thread.setDaemon(true);
	thread.start();

	driver = new ModelGeneratorDriver(1000);
	driver.showsModelGeneratorMode(NULL_MODE);
    }

    public void createsNewModel() {
	driver.createNewModel();
	driver.showsModellingSpace();
	driver.showsModelGeneratorMode(EDITING_MODE);
    }

    public void insertsAssignation() {
	driver.insertAssignation();
	driver.showsAssignationHasBeenInserted();
    }

    public void stop() {
	if (driver != null)
	    driver.dispose();
    }
}